﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ExportToRTR.CApExportToRTRLimit
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.ExportToRTR{

internal class CApExportToRTRLimit : ICApExportToRTRWriteable
{
  public double m_lower;
  public double m_upper;
  public double m_effort;
  public double m_velocity;
  public double m_acceleration;
  public double m_jerk;

  public CApExportToRTRLimit(TxJoint joint, double effort, double jerk)
  {
    bool flag = joint.Type == 2;
    this.m_lower = flag ? joint.LowerSoftLimit * (1.0 / 1000.0) : joint.LowerSoftLimit;
    this.m_upper = flag ? joint.UpperSoftLimit * (1.0 / 1000.0) : joint.UpperSoftLimit;
    this.m_effort = effort;
    this.m_velocity = joint.MaxSpeed;
    this.m_acceleration = joint.MaxAcceleration;
    this.m_jerk = jerk;
  }

  public void Write(CApExportToRTRXmlWriter writer)
  {
    writer.WriteStartElement("limit");
    writer.WriteAttributeString("lower", this.m_lower.ToString() ?? "");
    writer.WriteAttributeString("upper", this.m_upper.ToString() ?? "");
    writer.WriteAttributeString("effort", this.m_effort.ToString() ?? "");
    writer.WriteAttributeString("velocity", this.m_velocity.ToString() ?? "");
    writer.WriteAttributeString("acceleration", this.m_acceleration.ToString() ?? "");
    writer.WriteAttributeString("jerk", this.m_jerk.ToString() ?? "");
    writer.WriteEndElement();
  }
}
